<template>
    <div id="order-manage">
        <div class="title">
            <h1 @click="goBack">《返回列表</h1>
        </div>
        <div class="searchInfo">
            <el-form ref="form" :model="search_Data" label-width="80px" size="medium" :label-position="labelPosition"
            style="text-align:right ;"
            >
                <div class="search_col_top">
                    <el-form-item label="用户ID:">
                        {{uid}}
                    </el-form-item>
                    <el-form-item label="用户手机:">
                        {{utel}}
                    </el-form-item>
                    <el-form-item label="活动区域">
                        <el-select v-model="search_Data.area" placeholder="请选择活动区域" style="width: 150px" clearable>
                            <el-option label="全部" value="1"></el-option>
                            <el-option label="单人明区" value="2"></el-option>
                            <el-option label="单人暗区" value="3"></el-option>
                            <el-option label="双人明区" value="4"></el-option>
                            <el-option label="双人阅读区" value="5"></el-option>
                        </el-select>
                    </el-form-item>
                    <!-- <el-form-item label="订单状态">
                        <el-select v-model="search_Data.order_stateData" placeholder="请选择活动区域" style="width: 150px" clearable>
                            <el-option label="全部" value="1"></el-option>
                            <el-option label="未开始" value="2"></el-option>
                            <el-option label="进行中" value="3"></el-option>
                            <el-option label="已取消" value="4"></el-option>
                            <el-option label="已完成" value="5"></el-option>
                            <el-option label="已改期" value="6"></el-option>
                            <el-option label="已失效" value="7"></el-option>
                        </el-select>
                    </el-form-item> -->
                    <el-button type="info" @click="onSearchBtn">查询</el-button>
                </div>
            </el-form>

        </div>
        <!-- 表格 -->
        <el-table :data="tableData" tooltip-effect="dark" style="width: 100%;line-height: 0; margin-top: 20px;">
            <el-table-column prop="aname" label="区域" align="center">
            </el-table-column>
            <el-table-column prop="cname" label="名称" align="center" width="180" >
            </el-table-column>
            <el-table-column prop="buyTime" label="获得时间" align="center">
            </el-table-column>
            <el-table-column prop="expireTime" label="过期时间" align="center">
            </el-table-column>
            <el-table-column prop="channel" label="获取渠道" align="center" width="180" >
            </el-table-column>
            <el-table-column prop="price" label="支付金额" align="center">
            </el-table-column>
        </el-table>
        <el-pagination 
            style="float:right" 
            @current-change="handleCurrentChange" 
            :current-page.sync="page"
            :page-size="limit" 
            layout="prev, pager, next" 
            :total="total">
        </el-pagination>
    </div>
</template>

<script>
export default {
    data() {
        return {
            labelPosition: "center",
            // order_state: '',
            search_Data: {
                area:null,
            },
            tableData: [
                {list:[]}
            ],
            total:null,
            page:1,
            limit:5,
            uid:null,
            utel:null,
        }
    },
    methods: {
        getData(){
            this.$axios({
                url:'/coupon/purchase/list',
                method:'post',
                data:{
                    uid:9527,
                    aname:this.search_Data.area,
                    channel:null,
                    expireTime:'',
                    limit:this.limit,
                    page:this.page,
                    tel:'',
                }
            }).then(({data})=>{
                console.log({data})
                this.tableData=data.data.purchase
                this.total=data.data.count
            })
        },
        // 查询按钮
        onSearchBtn() {
            console.log(this.search_Data)
            this.getData()
        },
        // 取消订单
        cancelOrderId(row) {
            console.log(row)
        },
        handleCurrentChange (v) {
            this.page=v,
            this.getData()
        },
        goBack(){
            this.$router.push('/home/UserList')
        }
    },
    mounted() {
    this.getData();
    this.uid=this.$route.query.id,
    this.utel=this.$route.query.tel
  }
}


</script>


<style scoped lang="less">
#order-manage {
    width: 100%;
    height: 100%;
    // outline: 1px solid red;

    &>.title {
        line-height: 0;
        text-align: left;
    }
    &>.title h1{
        color: #48c0f4;
            cursor: pointer;
    }
    & .searchInfo {
        width: 100%;
        height: 50px;
        background: #d7d7d7;
        margin-top: 30px;
        padding-left: 10px;
        box-sizing: border-box;
        position: relative;
        min-width: 1440px;

        & .search_col_top {
            width: 100%;
            height: 50px;
            display: flex;
            align-items: center;
        }

        .el-form {
            height: 50px;
        }

        .el-form-item {
            margin-bottom: 0;
        }

        .el-form-item__label {
            padding-left: 20px;
        }

        .el-button {
            position: absolute;
            right: 200px;
        }

        .el-form-item__label {
            text-align: center;
            vertical-align: middle;
            float: left;
            font-size: 14px;
            color: #606266;
            line-height: 40px;
            /* padding: 0 12px 0 0; */
            box-sizing: border-box;
        }


    }

    


}
</style>